# -*- coding: utf-8 -*-
from fort.models import FortServerUser
from utils.ssh import MySSH
from utils.crypt_pwd import CryptPwd


class FortConsumer(MySSH):
    def __init__(self, *args, **kwargs):
        super(FortConsumer, self).__init__(*args, **kwargs)
        self.fort_user = FortServerUser.objects.get(id=self.scope['path'].split('/')[3])
        self.ip = self.fort_user.fort_server.server.IP
        self.port = self.fort_user.fort_server.port
        self.username = self.fort_user.fort_username
        self.password = CryptPwd().decrypt_pwd(self.fort_user.fort_password)
        self.coding = self.fort_user.get_fort_code_display()
